package atguigu.demo3

/**
  * Created by lzd on 2018/10/30.
  * scala 和 java 互换
  */
object demo3_4 {
  // 和Java的互操作

  import scala.collection.JavaConverters._
  import scala.collection.mutable
  import scala.collection.mutable.ArrayBuffer


  // Java to Scala
  def main(args: Array[String]): Unit = {
    val command = ArrayBuffer("ls", "-al", "/")
    // ProessBuilder是java方法
    val pb = new ProcessBuilder(command.asJava) // Scala to Java
    println(pb)
    val cmd: mutable.Buffer[String] = pb.command().asScala
    println(cmd)

    println(cmd == command)
  }
}
